/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						       creature_bank.h

	$Header: /game/creature_bank.h $

	$NoKeywords: $

 ************************************************************************/

#ifndef CREATURE_BANK_H_INCLUDED
#define CREATURE_BANK_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <vector>
#include "artifact.h"
#include "creature_array.h"
#include "material_array.h"
#include "stationary_adventure_object.h"

enum t_creature_bank_type;
enum t_creature_type;

struct t_creature_pair
{
	t_creature_type creature;
	int             amount;
};

// ------------------------------------------------------------------------
// fight creatures for a reward
// ------------------------------------------------------------------------
class t_creature_bank : public t_stationary_adventure_object, public t_creature_array
{
public:
	t_creature_bank( t_stationary_adventure_object const& source );

	virtual void			activate_trigger( t_army* army, t_adv_map_point const& point, 
							                       t_direction direction, t_adventure_frame* frame );
	virtual float			ai_value( t_adventure_ai const& ai, t_creature_array const& army, int move_cost ) const;	
	virtual float			ai_activation_value_drop( t_creature_array const& army ) const;
	virtual t_skill_mastery	get_anti_stealth_level() const;
	virtual int				get_version() const;
	virtual void			initialize( t_adventure_map& map );
	virtual void			on_combat_end( t_army* attacker, t_combat_result result, 
										   t_creature_array* losses, t_adventure_frame* frame );
	virtual bool			preplacement( t_adventure_map& map, int pass );
	virtual void			process_new_day();
	virtual void			right_click( t_mouse_event const& event,
										      t_adventure_frame* adventure_frame );
	virtual bool			read( std::streambuf&						stream, 
								       t_qualified_adv_object_type const&	type,
								       int									version );
	virtual void			read_postplacement( t_adventure_map& map );
	virtual bool			write( std::streambuf& stream ) const;
protected:

	void add_value( int days, t_adventure_map& map );
	int  create_artifacts( int value );
	void create_artifacts( int* artifact_array );
	void reset();
	void set_reward();

	t_artifact_list              m_artifacts;
	std::vector<t_creature_pair> m_creatures; // amounts are in 1/256th units
	t_material_array             m_materials;
	int                          m_restocking_delay;
	int                          m_reward_value;
	t_creature_bank_type		 m_type;
	std::vector<int>            m_visited;
};

#endif // CREATURE_BANK_H_INCLUDED